
import util from "../../../common/js/util.js";
import Qs from "qs";
var app = getApp();
Page({
  data: {
    entenring_data: { lastMsg: "", lastTime: "", totalResult: 0 },
    user_show:true
  },
  onLoad() {
    if(app.prototype.$SysUserName=="zhujindui"
    ||app.prototype.$SysUserName=="wangguangqiu"){
      this.setData({
        user_show:false
      })
    }
    this.getMessageList();
  },
  onPullDownRefresh() {
    // 页面被下拉
    this.getMessageList();
  },
  getMessageList() {
    //工作联系
    let api = "/YhERP/WorkOrder/json/MyList1", list = { currentPage: 1, showCount: 1, ListStatus: 'InProcess' };
    dd.showLoading({
      content: '数据加载中...',
    })
    app.$post(api, list).then(res => {
      dd.hideLoading();
      if (res.is == 1) {
        if (res.data.totalResult > 0) {
          //console.log(res.data);
          let entenring_data = this.data.entenring_data;
          let lastTime = res.data.dataList[0].DEADLINE;
          let time_arr = lastTime.split(" ");
          entenring_data.lastTime = time_arr[1];
          entenring_data.lastMsg = res.data.dataList[0].TITLE || "暂无最近消息";
          entenring_data.totalResult = res.data.totalResult;
          this.setData({
            entenring_data
          })
          
          dd.stopPullDownRefresh();
        }
      }
    });
  },
  onRouteEntenring() {
    let query = { ListStatus: 'InProcess' };
    let p = Qs.stringify(query);
    let path = '/pages/entenring_Informs/list/list';
    let url = `${path}?${p}`;
    dd.navigateTo({
      url
    })
  }
});
